#if !defined(AFX_REPORTMANAGEMENTDLG_H__3E9F5E48_4FD4_4E4D_875F_287DA4520116__INCLUDED_)
#define AFX_REPORTMANAGEMENTDLG_H__3E9F5E48_4FD4_4E4D_875F_287DA4520116__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ReportManagementDlg.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CReportManagementDlg dialog

#include "GUIBaseLib\TopDialog.h"
#include "BaseMethodCallback.h"

#define WM_APP_REPORTREADY            (WM_APP+120)
#define WM_APP_REPORTTEMPLETREADY     (WM_APP+130)
#define WM_APP_REPORTTEMPLETDATAREADY (WM_APP+140)
#define WM_APP_REPORTTEMPLETFAILURE   (WM_APP+150)

//#define AGR_EXCESSREPORT  1
//#define AGR_SWITCHREPORT  2

struct ReportTempletAckStruct;
struct ReportTempletUpdateStruct;
struct ReportTempletItem;
class ReportExporter;

class CReportManagementDlg : public CTopDialog, public BaseMethodCallback
{
// Construction
public:
	CReportManagementDlg(CWnd* pParent = NULL);   // standard constructor
  virtual void Callback(BaseMethodPerformer * pPerformer);

protected:
  CMutex m_mutexReportTempletItems;
  CMutex m_mutexReportTempletItem;
  std::vector<ReportTempletItem *> m_ReportTempletItems;
  BaseMethodPerformer * m_pPerformer;
  ReportTempletItem * m_pReportTempletItem;
  ReportExporter * m_pReportExporter;

protected:
  void DeleteReportTemplet();
  void DeleteReportTemplets();
  void RefreshListCtrl();
  void EnableAllControls(bool bEnable = true);
  void GenerateReport();
  void ModifyTemplet();

// Dialog Data
	//{{AFX_DATA(CReportManagementDlg)
	enum { IDD = IDD_DIALOG_REPORTMANAGEMENT };
	CButton	m_btnGenerate;
	CButton	m_btnClose;
	CButton	m_btnModify;
	CButton	m_btnDelete;
	CButton	m_btnAdd;
	CListCtrl	m_listctrl;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CReportManagementDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	// Generated message map functions
	//{{AFX_MSG(CReportManagementDlg)
	virtual BOOL OnInitDialog();
	virtual void OnCancel();
	afx_msg void OnAddTemplet();
	afx_msg void OnModifyTemplet();
	afx_msg void OnDblclkList(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnDeleteTemplet();
	afx_msg void OnEndLabelEdit(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnBeginLabelEdit(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnGenerateReport();
	//}}AFX_MSG
  afx_msg LRESULT OnReportReady(WPARAM wParam, LPARAM lParam);
  afx_msg LRESULT OnReportTempletReady(WPARAM wParam, LPARAM lParam);
  afx_msg LRESULT OnReportTempletDataReady(WPARAM wParam, LPARAM lParam);
  afx_msg LRESULT OnReportTempletFailure(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_REPORTMANAGEMENTDLG_H__3E9F5E48_4FD4_4E4D_875F_287DA4520116__INCLUDED_)
